package threadDemo;

/**
 * 与Test10一样，使用lambda表达式 去完成代码
 */
public class Test11 {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println("线程vip "+i);
            }
        },"t1");
        thread.start();
        for (int i = 0; i < 100; i++) {
            if(i==50){
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("主线程 ："+i);
        }
    }
}
